package com.jesper.service;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jesper.mapper.ItemCategoryMapper;
import com.jesper.model.ItemCategory;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ItemCategoryService extends ServiceImpl<ItemCategoryMapper, ItemCategory> {
    public Page<ItemCategory> query(int page, int pageSize, ItemCategory itemCategory) {

        QueryWrapper<ItemCategory> wrapper = new QueryWrapper<>();
        Page mPage = new Page<>(page, pageSize);

        wrapper.like(StrUtil.isNotBlank(itemCategory.getName()), "name", itemCategory.getName());

        return this.baseMapper.selectPage(mPage, wrapper);

    }

    public List<ItemCategory> list1() {
        return this.baseMapper.list1();
    }


}
